﻿using ProjectBordspil.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.Mvc;
using ProjectBordspil.Sevices;

namespace ProjectBordspil.Controllers
{
    public class HomeController : Controller
    {
        private IAppRepository _repository = null;

        private HomeServices home = new HomeServices();

        private AppDataContext context = new AppDataContext();

        public HomeController()
        {
            _repository = new AppRepository();
        }
        public HomeController(IAppRepository rep)
        {
            _repository = rep;
        }

        public ActionResult Index()
        {
            var topFivePlayers = home.TopFive();

            return View(topFivePlayers);
        }

        public ActionResult About()
        {
            return View();
        }
         
        public ActionResult Games()
        {
            var allGames = home.GetAllGames();
            
            return View(allGames);
        }

        public ActionResult ActiveGames()
        {
            var games = home.GetActiveGames();

            return View(games);
        }
       
        [Authorize]
        public ActionResult MyPage()
        {
            string userName = Membership.GetUser().UserName;

            MyViewModel myModel = home.SetUpMyPage(userName);

            return View(myModel);
        }

        public ActionResult Groups()
        {
            return View();
        }

        public ActionResult Rules()
        {
            return View();
        }
    }
}
